﻿/**********************************************************
*-----------------------------------*
* flareJ JavaScript Library
*-----------------------------------*
* 作者:Joe_Sky
* 邮箱:hitomi_doax@tom.com
* 最后更新时间:2011-8-24
*-----*-----*-----*-----*-----*-----*
* 基于jQuery
***********************************************************/

/*----------------------------------------------*
* flareJ.Window
*-------*-------*-------*-------*-------*-------*
* 弹出窗口
*-------*-------*-------*-------*-------*-------*
* (必须)需引入flareJ.Base.js
* (必须)需引入flareJ.Panel.js
* (可选)实现拖放需引入flareJ.DragDrop.js
*----------------------------------------------*/
(function ($) {
    var FJ = $.flareJ, flareJ = FJ;

    /************************************************************
    *-----------------------------------------------------------*
    *                         弹出窗口
    *-----------------------------------------------------------*
    *************************************************************
    *-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*
    * 
    *-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*
    * 调用方法1:$("#id").WINJ().show(); 选中某元素后弹出
    * 调用方法2:WINJ.show();            直接弹出
    ************************************************************/
    this.WindowJ = this.WINJ = FJ.WindowJ = FJ.WINJ = FJ.PJ.extend({
        //#region 构造方法
        init: function (elemObj, settings) {
            //参数
            this._super(elemObj, $.extend(true, {
                fjType: "WINJ",
                renderTo: "body",                          //要加载到的容器
                title: "浮动窗口",                                                                        //标题
                outPadding: { t: 0, r: 5, b: 0, l: 5 },    //外层补间宽度
                dragLeft: 0,                                                                         //拖拽左边距极限值
                dragTop: 0,                                                                             //拖拽上边距极限值
                dragRight: 0,                                                                        //拖拽右边距极限值
                dragBottom: 0,                                                                       //拖拽下边距极限值
                isCanDrag: true,                                                                        //是否可拖拽
                isResizable: true,                                                                      //是否可调整大小
                minWidth: 100,                                                                         //调整尺寸最小宽度值
                maxWidth: null,                                                                         //调整尺寸最大宽度值
                minHeight: 100,                                                                        //调整尺寸最小高度值
                maxHeight: null,                                                                        //调整尺寸最大高度值
                hasDivGray: false,                                                                      //是否有遮住整页的遮罩层
                grayZindex: 100000,                                                                     //整页遮罩层的z轴位置
                grayOpacity: 80,                                                                        //整页遮罩层的透明度
                showType: "fade",                      //弹出效果
                showLoading: true,
                speed: 350,
                loadSpeed: 200,
                loadDomType: "html",
                hasDdProxy: true,                          //是否使用拖放代理
                minOnClosing: false,                                                                    //关闭前是否先最小化
                typeSign: "static",                                                                   //以静态方法调用时层的标记
                closeModel: "hide",                                                                   //关闭模式(hide:关闭时隐藏,remove:关闭时删除)
                radius: FJ.isIEno9 ? 0 : 5,                  //圆角弧度
                showHead: true,                           //是否显示头部
                showFoot: true,                           //是否显示底部
                borderWidthB: 1,
                hasIfr: true,
                colorParams: {
                    grayColor: "#373737"
                },
                eType: (function(j){
                    return {
                        //afterrender: j
                    }
                })("WINJ")
            }, settings));

            this.fDdivGray = null;  //整页遮罩层

            return this;
        },
        //#endregion

        //#region 初始化
        initFn: function () {
            this._super();

            if (this.p.obj != null) {
                //由小变大
                this.objId = this.p.obj.attr("id");  //选中元素ID
                this.objOff = this.p.obj.offset();   //选中元素边距对象
            }
            else {
                //淡入淡出
                //this.objId = this.p.typeSign + new Date().getTime();
                this.p.showType = "fade";
            }

            //弹出位置默认为页面中心
            if (this.p.leftF == null) {
                this.p.leftF = FJ.pageWidth() / 2.0 - this.p.widthF / 2.0 + FJ.leftPosition();
            }
            if (this.p.topF == null) {
                this.p.topF = FJ.pageHeight() / 2.0 - this.p.heightF / 2.0 + FJ.topPosition();
            }
        },
        //#endregion

        //#region 构建
        create: function () {
            var thiz = this;

            //判断层是否已存在
            if ($("#WINJ_" + this.objId).length == 0) {
                this._super();

                //外层
                this.divOut.attr("id", "WINJ_" + this.objId).css({
                    position: "absolute"
                });

                this.pjHead.css("cursor", "move");
            }

            //#region 创建显示动画
            var _AJ;
            switch (this.p.showType) {
                case "minToMax":   //由小变大
                    _AJ = AJ_fly;
                    break;
                case "fade":   //淡入淡出
                    _AJ = AJ_easing;
                    break;
            }

            this.aj = new _AJ(this.divOut, {
                speed: this.p.speed,
                speed2: this.p.speed > 1 ? 70 : 1,
                sa: {
                    width: this.p.widthF,
                    height: this.p.heightF,
                    left: this.p.leftF,
                    top: this.p.topF
                },
                cbS: function () {
                    thiz.actualHeight = thiz.divOut.height();
                    thiz.loadBody("show");
                    thiz.setDragMaxRB();  //设置右边和下边拖放极限值为0时的值
                },
                cbC: function () {
                    thiz.fnCallBackClose();
                },
                cbP: function () {
                    //thiz.divOut.height(thiz.divOut.height());
                    thiz.pjBody.css({ width: "100%", height: "100%" });
                }
            });
            //#endregion

            //#region 设置缩放
            if (typeof (FJ.REJ) != "undefined") {
                if (this.p.isResizable) {
                    this.pjHead[0].cur = "move";  //设置元素原始指针样式
                    this.rej = $(this.divOut[0]).REJ({
                        d: (this.p.borderWidth > 4 ? this.p.borderWidth : 4),
                        miw: this.p.minWidth || 100,
                        mih: this.p.minHeight || 100,
                        maw: this.p.maxWidth || 1500,
                        mah: this.p.maxHeight || 1500,
                        padW: parseFloat(this.divOut.css("padding-left")) + parseFloat(this.divOut.css("padding-right")),
                        padH: parseFloat(this.divOut.css("padding-top")) + parseFloat(this.divOut.css("padding-bottom")),
                        olinkage: FJ.isIE6 ? this.pjIframe : null,
                        hasProxy: this.p.hasDdProxy,
                        onResizeStart: function () {
                            //显示透明遮罩层
                            $("#moveIframe_" + thiz.objId).show();
                        },
                        onResizeEnd: function () {
                            //隐藏透明遮罩层
                            $("#moveIframe_" + thiz.objId).hide();

                            //记录调整尺寸后的宽和高
                            if (thiz.p.divState == "max") {
                                thiz.actualHeight = thiz.divOut.height();
                            }

                            thiz.setDragMaxRB();  //设置右边和下边拖放极限值为0时的值
                            thiz.fixSize();  //修正尺寸

                            if (thiz.laj)
                                thiz.laj.reLayout();
                        }
                    });
                }
            }
            //#endregion

            //#region 设置拖放
            if (typeof (FJ.DRJ) != "undefined") {
                if (this.p.isCanDrag) {
                    this.drj = $(this.pjHead[0]).DRJ({
                        oRoot: this.divOut,
                        minX: this.p.dragLeft,
                        maxX: this.p.dragRight,
                        minY: this.p.dragTop,
                        maxY: this.p.dragBottom,
                        olinkage: FJ.isIE6 ? this.pjIframe : null,     //ie6下使iframe和面板一起被拖动
                        hasProxy: this.p.hasDdProxy,
                        drjCls: "pj-drj",
                        onDragStart: function () {
                            //显示透明遮罩层
                            $("#moveIframe_" + thiz.objId).show();
                        },
                        onDragEnd: function () {
                            //隐藏透明遮罩层
                            $("#moveIframe_" + thiz.objId).hide();
                        }
                    });
                }
            }
            //#endregion

            if (this.p.dragRight == 0) {  //浏览器滚动时重设在浏览器可视区域内拖拽的极限值
                $(window).bind("scroll", function () {
                    thiz.setDragMaxRB();
                });
            }

            this.fire("afterrender", "WINJ");
            return this;
        },
        //#endregion

        //#region 显示
        show: function () {
            var thiz = this;

            if (this.p.closeModel == "remove") {
                //this.create();
            }

            //加载整页遮罩层
            this.addDivGray();

            switch (this.p.showType) {
                case "minToMax":   //由小变大
                    this.aj.alterP({
                        sa: {
                            leftO: this.objOff.left,
                            topO: this.objOff.top
                        }
                    });
                    break;
                case "fade":   //淡入淡出
                    this.aj.alterP({
                        sa: {
                            left: this.p.leftF,
                            top: this.p.topF
                        }
                    });
                    break;
            }
            this.aj.go("s");

            return this;
        },
        //#endregion

        //#region 关闭
        close: function () {
            var thiz = this;

            if (thiz.p.minOnClosing) {
                thiz.changeMin();
            }

            //删除整页遮罩层
            thiz.deleteDivGray();

            //回收动画
            switch (thiz.p.showType) {
                case "minToMax":   //由小变大
                    break;
                case "fade":   //淡入淡出
                    this.aj.alterP({
                        sa: {
                            width: this.divOut.width(),
                            height: this.divOut.height(),
                            left: this.divOut.offset().left,
                            top: this.divOut.offset().top
                        }
                    });
                    break;
            }
            this.aj.go("c");
        },
        //#endregion

        //#region 关闭层回调函数
        fnCallBackClose: function () {
            //关闭层
            if (this.p.closeModel == "remove") {
                this.divOut.remove();
                if (FJ.isIE6) {
                    this.pjIframe.remove();
                }
            }
            else {
                if (FJ.isIE6) {
                    this.showIfr(false);
                }
            }

            //执行回调函数
            if (this.p.cbC != null) {
                this.p.cbC();
            }
        },
        //#endregion

        //#region 加载内容页完毕回调函数
        loadBodyCB: function (type) {
            this._super(type);

            switch (type) {
                case "show":
                    this.renderDivGray();
                    break;
                case "reload":
                    break;
            }
            if (FJ.isIE6) {
                this.showIfr(true);
            }
            
            this.fixSize();  //修正尺寸
        },
        //#endregion

        //#region 最大最小化
        maxMin: function (cb, speed) {
            var thiz = this;
            this._super(function () {
                thiz.setDragMaxRB();
            }, speed);
        },
        //#endregion

        //#region 设置只能在浏览器可视区域内拖拽
        setDragMaxRB: function () {
            if (this.p.dragRight == 0 && this.drj) {
                this.drj.p.minX = document.documentElement.scrollLeft + document.body.scrollLeft;
                this.drj.p.minY = document.documentElement.scrollTop + document.body.scrollTop;
                this.drj.p.maxX = document.documentElement.clientWidth + document.documentElement.scrollLeft + document.body.scrollLeft - (parseInt(this.divOut[0].clientWidth) + parseInt(this.divOut.css("border-left-width")) + parseInt(this.divOut.css("border-right-width")));
                this.drj.p.maxY = document.documentElement.clientHeight + document.documentElement.scrollTop + document.body.scrollTop - (parseInt(this.divOut[0].clientHeight) + parseInt(this.divOut.css("border-top-width")) + parseInt(this.divOut.css("border-bottom-width")));
            }
        },
        //#endregion

        //#region 加载全屏遮罩层
        addDivGray: function () {
            if (this.p.hasDivGray) {
                this.divOut.css("z-index", this.p.grayZindex + 2);
                this.fDdivGray = $('<div id="divDg_' + this.objId + '" style="background-color:' + this.p.colorParams.grayColor + ';filter:alpha(opacity=' + this.p.grayOpacity + ');opacity:' + this.p.grayOpacity / 100.0 + ';position:absolute;top:0;left:0;z-index:' + this.p.grayZindex + ';"></div>');
                //this.fDdivGray.css({ width: document.documentElement.scrollWidth, height: document.documentElement.scrollHeight });   $(document).width()
                this.fDdivGray.css({ width: document.documentElement.scrollWidth, height: $(document).height() });
                if (FJ.isIE6) {
                    this.pjIframe.css("z-index", this.p.grayZindex + 1);
                    this.pjIframeGray = $("<iframe frameborder='0' scrolling='no' style='filter:alpha(opacity=0);-moz-opacity:0;position:absolute;top:0;left:0;z-index:" + (this.p.grayZindex - 1) + ";'></iframe>");
                    this.pjIframeGray.css({ width: document.documentElement.scrollWidth, height: document.documentElement.scrollHeight });
                }
            }
        },
        //#endregion

        //#region 渲染全屏遮罩层
        renderDivGray: function () {
            if (this.p.hasDivGray) {
                $("body").prepend(this.fDdivGray);
                if (FJ.isIE6) {
                    $("body").prepend(this.pjIframeGray);
                }
            }
        },
        //#endregion

        //#region 删除全屏遮罩层
        deleteDivGray: function () {
            var thiz = this;
            setTimeout(function () {
                if (thiz.p.hasDivGray) {
                    if ($("#divDg_" + thiz.objId).length > 0) {
                        thiz.divOut.css("z-index", thiz.p.zIndex);
                        thiz.fDdivGray.animate({
                            opacity: 0
                        },300,function(){
                           thiz.fDdivGray.remove(); 
                        });
                        
                        if (FJ.isIE6) {
                            thiz.pjIframe.css("z-index", thiz.p.zIndex - 1);
                            thiz.pjIframeGray.remove();
                        }
                    }
                    else {
                        thiz.deleteDivGray();
                    }
                }
            }, 100);
        }
        //#endregion
    });

    //#region 静态调用方法
    FJ.WINJ.init = function (settings) {
        return new FJ.WINJ(null, settings);
    };

    FJ.WINJ.show = function (settings) {
        return new FJ.WINJ(null, settings).show();
    };
    //#endregion

    //#region 右下角浮动层
    FJ.WINJ.corner = function (settings) {
        return FJ.WINJ.show($.extend(true, {
            zIndex: 100,
            leftF: -10000,
            topF: -10000,
            widthF: 260,
            heightF: 150,
            minWidth: 260,
            minHeight: 150,
            maxWidth: 260,
            maxHeight: 150,
            minSpeed: 1500,
            minOnClosing: false,
            speed: 1,
            loadSpeed: 1,
            headHeight: 25,
            isCanDrag: false,
            isResizable: false,
            urlType: "html",
            footHeight: 4,
            showFoot: true,
            btns: null,
            cbS: function () {
                //禁用关闭按钮
                this.pjBtnClose.hide();
                this.pjBtnMin.css("clear", "both");

                //初始状态设为最小化
                this.min(0);

                //浮动在右下角
                if (FJ.isIE6) {
                    this.divOut.css("top", "auto").css("left", "auto").css("right", "0").css("bottom", "0").css("position", "absolute").addClass("top");
                    //$("body").css("background-attachment", "fixed").css("background-image", "url(nothing.txt)");

                    (function (divOut) {
                        $(window).bind("scroll", function () {
                            divOut.css("height", parseFloat(divOut.css("height")) + 1).css("height", parseFloat(divOut.css("height")) - 1);
                        });
                    })(this.divOut);
                }
                else {
                    this.divOut.css("top", "auto").css("left", "auto").css("right", "0").css("bottom", "0").css("position", "fixed");
                }
            }
        }, settings));
    };
    //#endregion

    //#region 图品背景窗口
    FJ.WINJ.imgbg = function (settings) {
        return FJ.WINJ.init($.extend(true, {
            title: "窗口",
                zIndex: 100000,
                dragLeft: null,  
                dragTop: 0,   
                dragRight: null, 
                dragBottom: null,
                widthF: 800,
                heightF: 450,
                minWidth: 450,
                minHeight: 200,
                maxWidth: 1000,
                maxHeight: 600,
                hasDivGray: true,
                minOnClosing: false,
                headHeight: 25,
                footHeight: 4,
                imgSize: { w:23,h:16 },
                borderWidth: 1,
                //loadType: "iframe",
                useImgBorder: true,
                bodyUrl: "http://www.360buy.com",
                showType: "fade",
                isCanMinimize: false,
                btns: null
        }, settings));
    };
    //#endregion

    //#region 绑定到jquery
    $.fn.extend({
        WindowJ: function (settings) {
            //返回浮动层对象
            return new FJ.WindowJ(this, settings);
        },
        WINJ: function (settings) {
            return $(this).WindowJ(settings);
        },
        FloatDivJ: function (settings) {
            return $(this).WindowJ(settings);
        },
        FDJ: function (settings) {
            return $(this).WindowJ(settings);
        }
    });
    //#endregion

    //#region 保留旧版本的对象名
    this.FloatDivJ = this.FDJ = FJ.FloatDivJ = FJ.FDJ = FJ.WINJ;
    //#endregion

    /************************************************************
    *-----------------------------------------------------------*
    *                         提示框
    *-----------------------------------------------------------*
    *************************************************************
    *-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*
    * 
    *-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*
    * 调用方法:MBJ.show();
    ************************************************************/
    this.MessageBoxJ = this.MBJ = FJ.MessageBoxJ = FJ.MBJ = FJ.WINJ.extend({
        //#region 构造方法
        init: function (settings) {
            //参数
            this._super(null, $.extend(true, {
                fjType: "MBJ",
                title: "系统提示",              //标题
                outPadding: { t: 0, r: 4, b: 0, l: 4 },    //外层补间宽度
                msgType: "alert",               //提示框类型
                msgContent: "",                 //提示框内容
                msgImg: "important.gif",        //提示框图标
                callBackOK: null,               //确定回调函数
                callBackCancel: null,           //取消回调函数
                dragTop: 0,                     //拖拽上边距极限值
                dragLeft: 0,                    //拖拽右边距极限值
                speed: 350,
                widthF: 280,
                heightF: 100,
                isCanMinimize: false,
                isResizable: false,
                showLoading: false,
                loadSpeed: 1,
                headHeight: 25,
                hasDivGray: true,
                grayZindex: 1000000,
                closeTimeout: null,
                urlType: "html",
                closeModel: "remove",
                footHeight: 4,
                showFoot: true,
                btns: null,
                fnHtml: function (p) {
                    var thiz = this;

                    this.mbjTable = $("<table class='mbj_table'></table>");
                    this.mbjTr1 = $("<tr></tr>");
                    this.mbjTr2 = $("<tr></tr>");
                    this.mbjTdL1 = $("<td class='mbj_td_left' rowspan='2'></td>");
                    this.mbjTdR1 = $("<td class='mbj_td_right_1'>" + this.p.msgContent + "</td>");
                    this.mbjTdR2 = $("<td class='mbj_td_right_2'></td>");

                    //提示框图标
                    this.mbjImg = $("<img src='" + PJ.imgFolderSrc + this.p.msgImg + "' />");

                    //确定按钮
                    this.mbjBtnOK = $("<input type='button' value='确定' class='pj_btn' />");
                    this.mbjBtnOK.click(function () {
                        if(thiz.timeoutClose)
                            clearTimeout(thiz.timeoutClose);
                        if (thiz.p.callBackOK != null) {
                            thiz.p.callBackOK.call(thiz);
                        }
                        thiz.close();
                    });

                    this.mbjTdL1.append(this.mbjImg);
                    this.mbjTr1.append(this.mbjTdL1).append(this.mbjTdR1);
                    this.mbjTable.append(this.mbjTr1).append(this.mbjTr2);

                    //加载提示框按钮
                    switch (this.p.msgType) {
                        case "alert":
                            this.mbjTr2.append(this.mbjTdR2);
                            this.mbjTdR2.append(this.mbjBtnOK);
                            break;
                        case "confirm":
                            this.mbjTr2.append(this.mbjTdR2);
                            //取消按钮
                            this.mbjBtnCancel = $("<input type='button' value='取消' class='pj_btn' style='margin-left:10px;' />");
                            this.mbjBtnCancel.click(function () {
                                if(thiz.timeoutClose)
                                    clearTimeout(thiz.timeoutClose);
                                if (thiz.p.callBackCancel != null) {
                                    thiz.p.callBackCancel.call(thiz);
                                }
                                thiz.close();
                            });
                            this.mbjTdR2.append(this.mbjBtnOK).append(this.mbjBtnCancel);
                            break;
                        case "prompt":
                            this.mbjTr2.append(this.mbjTdR2);
                            this.mbjBtnCancel = $("<input type='button' value='取消' class='pj_btn' style='margin-left:10px;' />");
                            this.mbjBtnCancel.click(function () {
                                if(thiz.timeoutClose)
                                    clearTimeout(thiz.timeoutClose);
                                if (thiz.p.callBackCancel != null) {
                                    thiz.p.callBackCancel.call(thiz);
                                }
                                thiz.close();
                            });
                            //输入文本框
                            this.mbjTxt = $("<input type='text' style='height:15px;width:" + (this.p.widthF - 100) + "px;float:left;margin-bottom:5px;' />");
                            if (this.p.txtO) this.mbjTxt.val(this.p.txtO);
                            this.mbjTdR2.append(this.mbjTxt).append(this.mbjBtnOK).append(this.mbjBtnCancel);
                            this.mbjBtnOK.css("margin-bottom",5);
                            this.mbjBtnCancel.css("margin-bottom",5);
                            break;
                        case "loading":
                            this.mbjTdR1.attr("rowspan", "2").css("padding-top", "0");
                            this.pjBtnClose.hide();
                            break;
                    }

                    //关闭按钮
                    this.pjBtnClose.click(function () {
                        if(thiz.timeoutClose)
                            clearTimeout(thiz.timeoutClose);
                        thiz.close(true);
                    });

                    //一定时间后关闭
                    if (this.p.closeTimeout != null) {
                        this.timeoutClose = setTimeout(function () {
                            thiz.close(true);
                        }, this.p.closeTimeout);
                    }

                    return this.mbjTable;
                },
                callbackS: function () {
                    this.mbjBtnOK.focus();   //使确定按钮获得焦点,便于点击回车键
                },
                grayOpacity: 1,
                colorParams: {                             //颜色参数
                    bgColor: "#cbcbcb",                    //背景色
                    borderOut: "#999999",                  //外层边框
                    bgColorBody: "#ffffff",
                    borderBody: "#999999",
                    bgColorHeadJ: "#bfbdbd",               //头部背景渐变色
                    bgColorHeadJT: "#E6E5E5",
                    bgColorHead: "#cbcbcb",
                    bgColorHeadU: "#d9d9d9",
                    bgColorFoot: "#cbcbcb",               //底部背景色
                    bgColorFootJ: "#E6E5E5",              //底部背景渐变色(下)
                    bgColorFootJT: "#bfbdbd",             //底部背景渐变色(上)
                    bgColorFootU: "#d9d9d9",              //底部上半边背景色(非IE浏览器下显示)
                    buttonColor: "transparent",                //按钮颜色
                    fontColorHead: "#7d7d7d"               //头部字体颜色
                },
                eType: (function(j){
                    return {
                        afterrender: j
                    }
                })("MBJ")
            }, settings));
        },
        //#endregion

        //#region 构建
        create: function () {
            this._super();
            this.fire("afterrender", "MBJ");
            return this;
        },
        //#endregion

        //#region 显示
        show: function () {
            var thiz = this;

            //播放弹出声音
            switch (this.p.msgType) {
                case "alert":
                    FJ.playSound.play("mbj2");
                    break;
                case "confirm":
                    FJ.playSound.play("mbj1");
                    break;
                case "prompt":
                    FJ.playSound.play("mbj1");
                    break;
            }

            //使外层可以自动适应内容层高度
            this.p.cbM = function () {
                thiz.divOut.css("height", "auto");
                thiz.pjBody.css("height", "auto");
            };

            //解决使用图片背景时头部出现空白
            if((FJ.isIE7 || FJ.isIE8) && this.p.useImgBorder){
                this.pjBtnClose.css("margin-top", -1);
                this.pjBg.find("tr").eq(0).find("td").height(2);
            }

            //执行基类方法
            this._super();

            //内容页不显示滚动条
            this.bodyIn.css({
                overflowX: "hidden",
                overflowY: "hidden",
                overflow: "hidden"
            });

            return this;
        },
        //#endregion

        //#region 关闭
        close: function (isRunCb) {
            //如果直接点击关闭按钮则执行回调函数
            if (isRunCb) {
                switch (this.p.msgType) {
                    case "alert":
                        if (this.p.callBackOK != null) {
                            this.p.callBackOK();
                        }
                        break;
                    case "confirm":
                        if (this.p.callBackCancel != null) {
                            this.p.callBackCancel();
                        }
                        break;
                }
            }

            //执行基类方法
            this._super();
        }
        //#endregion
    });

    //#region 通用设置
    //颜色
    FJ.MBJ.setColor = function () {
        return {
            bgColor: "#cbcbcb",                    //背景色
            borderOut: "#999999",                  //外层边框
            bgColorBody: "#ffffff",
            borderBody: "#999999",
            bgColorHeadJ: "#bfbdbd",               //头部背景渐变色
            bgColorHeadJT: "#E6E5E5",
            bgColorHead: "#cbcbcb",
            bgColorHeadU: "#d9d9d9",
            bgColorFoot: "#cbcbcb",               //底部背景色
            bgColorFootJ: "#E6E5E5",              //底部背景渐变色(下)
            bgColorFootJT: "#bfbdbd",             //底部背景渐变色(上)
            bgColorFootU: "#d9d9d9",              //底部上半边背景色(非IE浏览器下显示)
            buttonColor: "transparent",                //按钮颜色
            fontColorHead: "#7d7d7d"               //头部字体颜色
        };
    };

    //是否使用图片背景
    FJ.MBJ.useImgBg = false;
    //#endregion

    //#region 一般静态调用方法
    FJ.MBJ.show = function (settings) {
        return new FJ.MBJ(settings).show();
    };
    //#endregion

    //#region 只有确定按钮的提示框
    FJ.MBJ.alert = function (title, msgContent, callBackOK, timeout) {
        return new FJ.MBJ({
            title: title,
            msgContent: msgContent,
            callBackOK: callBackOK,
            msgType: "alert",
            msgImg: "important.gif",
            closeTimeout: timeout,
            colorParams: FJ.MBJ.setColor(),
            useImgBorder: MBJ.useImgBg
        }).show();
    };
    //#endregion

    //#region 有确定和取消的提示框
    FJ.MBJ.confirm = function (title, msgContent, callBackOK, callBackCancel) {
        return new FJ.MBJ({
            title: title,
            msgContent: msgContent,
            callBackOK: callBackOK,
            callBackCancel: callBackCancel,
            msgType: "confirm",
            msgImg: "help.gif",
            colorParams: FJ.MBJ.setColor(),
            useImgBorder: MBJ.useImgBg
        }).show();
    };
    //#endregion

    //#region 有确定和输入文本框的提示框
    FJ.MBJ.prompt = function (title, msgContent, callBackOK, txtO, callBackCancel) {
        return new FJ.MBJ({
            title: title,
            msgContent: msgContent,
            callBackOK: callBackOK,
            txtO: txtO,
            msgType: "prompt",
            msgImg: "info.gif",
            heightF: 110,
            colorParams: FJ.MBJ.setColor(),
            useImgBorder: MBJ.useImgBg
        }).show();
    };
    //#endregion

    //#region 加载中提示框
    FJ.MBJ.loading = function (title, msgContent) {
        return new FJ.MBJ({
            title: title,
            msgContent: msgContent,
            msgType: "loading",
            msgImg: "loading01.gif",
            speed: 1,
            heightF: 50,
            colorParams: FJ.MBJ.setColor(),
            useImgBorder: MBJ.useImgBg
        }).show();
    };
    //#endregion

    //#region 初始化弹出声音
    FJ.playSound.init("mbj1", FJ.media + "XP_dingdangsheng.wav");
    FJ.playSound.init("mbj2", FJ.media + "XP_jingtanhao.wav");
    //#endregion

    //#region 加载css
    $("head").append('<link id="MessageBoxJStyle" href="' + FJ.cssPath + 'flareJ.MessageBox.css" rel="stylesheet" type="text/css" />');
    //#endregion

})(jQuery);